package  com.naiking.manager
{
	import flash.net.SharedObject;
	public class SharedObjManager
	{
		private static const NAME:String="LOCAL";
		/**
		 *添加要保存的数据到缓存 
		 * @param key 键值
		 * @param data变量值
		 * 
		 */		
		public static function addData(key:String,data:Object):void
		{
			var share:SharedObject=SharedObject.getLocal(NAME);
			share.data[key]=data;
		}
		/**保存缓存*/
		public static function saveData():void
		{
			var share:SharedObject=SharedObject.getLocal(NAME);
			share.flush();
		}
		public static function getValueByName(name:String):Object
		{
			var share:SharedObject=SharedObject.getLocal(NAME);
			if(share.data.hasOwnProperty(name))
			{
				return share.data[name];
			}
			return undefined;
		}
		public function SharedObjManager()
		{
		}
	}
}